from django.http import JsonResponse


def rest_response(func):
    def inner(request, *args, **kwargs):
        response = {
            "code": 2000,
            "msg": "success",
            "data": func(request, *args, **kwargs)
        }
        return JsonResponse(response)

    return inner
